#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
int a[MAXN];
int main(){
    int t; cin >> t;
    while (t--) {
        int n, maxa = 0;
        cin >> n;
        for (int i = 1; i <= n; i++) {
            cin >> a[i];
            maxa = max(a[i], maxa);
        }
        bool flag = true;
        for (int i = 1; i <= n; i++) {
            if (maxa % a[i] != 0) {
                flag = false;
                break;
            }
        }
        if (flag) cout << "Yes";
        else cout << "No";
    }
    return 0;
}